class Solution
{
public:
    string solve(string s, string t)
    {
        int end1 = s.size() - 1;
        int end2 = t.size() - 1;
        string ret;
        int next = 0;
        while (end1 >= 0 || end2 >= 0 || next == 1)
        {
            int val1 = end1 < 0 ? 0 : s[end1--] - '0';
            int val2 = end2 < 0 ? 0 : t[end2--] - '0';
            int mul = val1 + val2 + next;
            next = mul / 10;
            ret += mul % 10 + '0';
        }
        reverse(ret.begin(), ret.end());

        return ret;
    }
};